package com.example.demo.controller;

import com.example.demo.Mappers.CancelPatientInfoMapper;
import com.example.demo.beans.CancelPatientInfoRequest;
import com.example.demo.beans.CancelPatientInfoResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2018/4/11.
 */
@RestController
public class CancelPatientInfoController {
    @Autowired
    CancelPatientInfoMapper mapper;
    @ResponseBody
@RequestMapping(value = "CancelPatientInfo",produces = {"application/xml"})
public CancelPatientInfoResponse cancleregist(@RequestBody CancelPatientInfoRequest request){
        CancelPatientInfoResponse response=new CancelPatientInfoResponse();
        if(request!=null){
          if (mapper.CancelPatientIn(request.getBankCardNo())>=1){
              response.setResultCode("0");
              response.setResultMsg("取消绑定成功");
              return  response;
          }else{
              response.setResultCode("2");
              response.setResultMsg("该卡未注册！");
              return  response;}


        }
       response.setResultCode("1");
        response.setResultMsg("没有获取到请求信息");
        return  response;
    }
}
